<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>用户信息</title>
    <%@include file="/WEB-INF/pages/common/taglib.jsp" %>
    <%@include file="/WEB-INF/pages/common/common.jsp" %>
    <style>
        .required {
            color: #f00;
            margin-right: 5px;
        }
    </style>
</head>
<body>
<div>
    <div class="header_line">
        当前位置：用户信息管理<span>&gt;</span><strong>个人信息</strong>
    </div>
    <div class="mt10"></div>
    <form id="form_data1" action="${basePath}/center/updateOperateInfo">
        <table class="table_detail">
            <tr class="tr_header">
                <td colspan="2">&nbsp;&nbsp;个人信息</td>
            </tr>
            <tr>
                <td class="width30p"><label><span class="required">*</span>用户名</label></td>
                <td class="width70p"><label style="margin-left: 15px;">${userInfo.logName}</label></td>
                <input type="hidden" value="${userInfo.logName}" name="logName" id="logName">
            </tr>
            <tr>
                <td class="width30p"><label>注册邮箱</label></td>
                <td class="width70p"><label style="margin-left: 15px;">
                    <input type="text" value="${userInfo.email}" disabled></label></td>
            </tr>
            <tr>
                <td class="width30p"><label><span class="required">*</span>姓名</label></td>
                <td class="width70p"><label style="margin-left: 15px;">
                    <input type="text" id="cnName" name="cnName" value="${userInfo.name}"></label>
                </td>
            </tr>
            <tr>
                <td class="width30p"><label><span class="required">*</span>身份证号码</label></td>
                <td class="width70p"><label style="margin-left: 15px;">
                <input type="text" name="idNo" value="${idNo}" id="idNo"></label></td>
            </tr>
            <tr>
                <td class="width30p"><label><span class="required">*</span>手机号</label></td>
                <td class="width70p"><label style="margin-left: 15px;">
                    <input type="text" name="mobilePhoneNumber" id="mobilePhoneNumber" value="${userInfo.phone}"></label></td>
            </tr>
            <tr class="tr_button">
            <td colspan="2">
            <input type="submit" value="提交">
            </td>
            </tr>
        </table>
    </form>
</div>
<script>
    $(function () {
        if (${status eq 1}) {
            layer.alert("保存成功！", {icon: 6});
        }
        if (${status eq 0}) {
            layer.alert("邮箱或者手机已经存在！保存失败！", {icon: 5})
        }
        $("#form_data1").validate({
            debug: false, //false表示验证通过后不要自动提交表单
            onkeyup: false, //表示关闭按键松开时候监听验证
            rules: {
                cnName: {
                    required: true,
                    maxlength: 30
                },
                idNo: {
                    required: true,
                    checkIdNo: true
                },
                mobilePhoneNumber: {
                    required: true,
                    rangelength: [11, 11],checkMobile:true
                }
            },
            messages: { //自定义错误信息，默认为英文，除了在这里配置以为，还可以通过配置文件进行配置
                cnName: {
                    required: "请输入姓名" ,
                    maxlength: "长度超过最大30个字符限制"
                },
                idNo: {
                    required: "请输入身份证号"
                },
                mobilePhoneNumber: {
                    required: "请输入手机号"
                    , rangelength: "请输入11位手机号"
                }
            },
            //验证通过可以在这里做你想做的事情
            submitHandler: function (form) {
                form.submit();
            }
        });
    });

    jQuery.validator.addMethod("checkIdNo", function (value) {
        var reg = /^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/;
        if (reg.test(value)) {
            return true;
        }
        return false;
    }, "请输入15或18位身份证号码");
    jQuery.validator.addMethod("checkMobile", function (value) {
        var reg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
        if (reg.test(value)) {
            return true;
        }
        return false;
    }, "请输入有效的手机号码");
</script>
</body>
</html>
